﻿@model  Logic.Models.TaskCreateModel
@{
    Layout = Logic.ViewConfiguration.GetViewConfig().Tasks_Index_Layout;
    ViewBag.Title = "Tasks";
}

<script>
    var Model = 
    {
        lists:@Html.Raw(Logic.Extentions.ToJson(Model))
    };
</script>

<div class="OuterBox TasksIndex">
    <div class="Title">
        <img src="@(Logic.Constants.CurrentUrl)/Images/General/Clarizen.png" />
        <span class="clarizen-beta">BETA</span>

        <div class="Links">
            <span class='Link' onclick="viewTaskInClarizen($('[name=\'ID.Value\']').val()); return false;">View in Clarizen</span>
            |
            <span class='Link' onclick='logout()'>Log Out</span>
        </div>
    </div>
    <div class="Body">
        
        <div class="Container">
    <div id='tasksPage'>
        <div class="Filters">
            <div id="filterType" style='float:left'>
                @Html.DropDownList("WorkItemState", Enum.GetNames(typeof(Logic.ClarizenSvc.WorkItemState)).Select(f => new SelectListItem { Text = Logic.Extentions.Spacify(f), Value = f, Selected = f == Logic.ClarizenSvc.WorkItemState.Current.ToString() }), new {Class="filter" })
                @Html.DropDownList("WorkItemFilter", Enum.GetNames(typeof(Logic.ClarizenSvc.WorkItemFilter)).Where(f => f != Logic.ClarizenSvc.WorkItemFilter.IManageTheProject.ToString()).Select(f => new SelectListItem { Text = Logic.Extentions.Spacify(f), Value = f, Selected = f == Logic.ClarizenSvc.WorkItemFilter.IHaveAnyRole.ToString() }), new { Class = "filter" })
                <input type="text" id="tbFilter" value="@Request.QueryString["q"]" class="Inset"/>
            </div>
            <input type="button" class="CreateNewLink" value="Create new" onclick="OpenCreateNew()" />
            
        </div>
        <div id="tasksContainer" style="list-style: none; clear:both">
        </div>
    </div>
    <div id="tasksDetails" class='CreateForm' style="display: none">
        <form  style="zoom:1">
                @{Html.RenderPartial("_formUpdate");}
                <div style="clear:both">
                    
                </div>

                <div class="Footer">
                    <div class="FooterWrap">
                        <div class="fl">
                                <span type='button' class='FormDisplay Link' onclick='TaskDisplay.back();'>back</span>
                        </div>
                        <div class="fr">
                                <span id='btnCancel' type='button' class='FormInput Link' onclick="TaskDisplay.cancel();">Cancel</span>
                                <input type='button' class='FormDisplay' value='Edit' onclick='TaskDisplay.switchTaskDisplay(true);'/>
                                <input type='button' id='btnSubmit' value='Update' class="FormInput" />
                        </div>
                    </div>
                </div>
        </form>
    </div>
</div>
    </div>
</div>
<script src="@(Logic.Constants.CurrentUrl)/Content/tasksindex.c.min.js" type="text/javascript"></script>

<script>
    function OpenCreateNew()
    {
        var og_f = 'resizable=1, openposition=center, savelocation=0, saveresizedsize=0';
        var endUrl = '@(Logic.Constants.CurrentUrl)/tasks/create';
        var width = 790;
        var height = 500;

        // hack for chrome because conduit has a proble with opening https in chrome
        if (navigator.userAgent.toLowerCase().indexOf('chrommmme') > -1)
        {
            url = "@(Logic.Constants.CurrentUrl.Replace("https://","http://"))" + "/conduit/ChromeLandingPage?url=" + escape(endUrl);
            OpenGadget(url, width, height, og_f);
        }
        else
        {
            OpenGadget(endUrl, width, height, og_f);
        }

    }
</script>



<!--[if IE 7]>
    <style>
        .DataTableContainer table [col="5"] {width: 147px!important;}
    </style>
<![endif]-->

